﻿using IntelligentAgriculture.Contracts.Interface.ColumnManagements;
using IntelligentAgriculture.Domain.Entity;
using IntelligentAgriculture.WebAPI.Application.Command.ColumnManageCommand;
using MediatR;

namespace IntelligentAgriculture.WebAPI.Application.CommandHandler.ColumnManageCommandHandler
{
    /// <summary>
    /// 根据栋舍获取栏位
    /// </summary>
    public class GetColumnManagementCommandHandler : IRequestHandler<GetColumnManagementCommand, Results<IQueryable<Columnmanagement>>>
    {
		private readonly IColumnManageService _icolumnManageService;

		public GetColumnManagementCommandHandler(IColumnManageService icolumnManageService)
        {
            _icolumnManageService = icolumnManageService;
        }
		public async Task<Results<IQueryable<Columnmanagement>>> Handle(GetColumnManagementCommand request, CancellationToken cancellationToken)
        {
            var list=await _icolumnManageService.GetColumnManagement(request.ridgepoleId);
            return Results<IQueryable<Columnmanagement>>.DataResult(list);
        }
    }
}
